<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>注册账号</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="{THEME_PATH}styles/swiper.min.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/reset.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/common.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/style.css">
	<script src="{THEME_PATH}js/jquery-1.8.3.min.js"></script>
	<script src="/statics/js/layer/layer.js"></script>
</head>
<body>
	<!-- S header -->
	<header>
		<a href="/index.php?m=user&c=public&a=login" class="headerL iconfont">&#xe69f;</a>
		<h1>注册账号</h1>
	</header>
	<!-- E header -->
	
	<div class="registerBox">
		<ul class="change_num_box">	
			<li class="flex invite_code_box">
				<label class="label">邀请码</label>
				<div class="flex-1 input_box"><input type="text" placeholder="请输入您的邀请码" class="alignR" name="invite_code" onblur="if(this.value.length != 6 || this.value==''){layer.msg('邀请码长度为6位');this.value='';}" value="<?php echo $yinfo['invite_code']; ?>"></div>
			</li>
			<li class="flex">
				<label class="label">昵称</label>
				<div class="flex-1 input_box"><input type="text" placeholder="请输入您的昵称" class="alignR" name="nickname" onblur="if(this.value == ''){layer.msg('请输入昵称');this.value='';}"></div>
			</li>
			<li class="flex">
				<label class="label">手机号</label>
				<div class="flex-1 input_box"><input type="text" placeholder="请输入您的手机号" class="alignR" name="username" ></div>
			</li>
			<li class="flex">
				<label class="label">图形验证码</label>
				<div class="flex-1 input_box"><input type="text" placeholder="" class="alignR" name="captcha" onblur="check_captcha(this.value)"></div>
				<!-- <a href="" class="tx_yzm"><img src="{THEME_PATH}images/yzm.png" alt="" width="85" height="37"></a> -->
				<!-- <a href="javascript:;" class="tx_yzm"> -->
				&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="" class="tx_yzm">
					<img src="<?php echo U('verify') ?>" id="verify" alt="看不清楚，换一张" style="cursor: pointer; vertical-align:middle; margin-top:-4px!important;maargin-top:-0px" onclick="this.src='<?php echo U('verify') ?>&_t=' + Math.round(new Date().getTime()/1000)" />
				</a>

				
			</li>
			<li class="flex">
				<label class="label">登录密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="请输入您的登录密码" class="alignR" name="password" onblur="if(this.value == ''){layer.msg('请输入登录密密码')}"></div>
			</li>
			<li class="flex">
				<label class="label">确认登录密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="请再次输入您的登录密码" class="alignR" name="confirm_password" onblur="if(this.value == ''){layer.msg('请输入确认登录密密码')}"></div>
			</li>
			<li class="flex">
				<label class="label">交易密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="请输入您的交易密码" class="alignR" name="pay_password" onblur="if(this.value.length != 6){layer.msg('请输入6位长度的支付密码')}" onkeyup="this.value=this.value.replace(/\D/g,'')"></div>
			</li>
			<li class="flex">
				<label class="label">确认交易密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="请再次输入您的交易密码" class="alignR" name="confirm_pay_password" onblur="if(this.value.length != 6){layer.msg('请输入6位长度的确认支付密码')}" onkeyup="this.value=this.value.replace(/\D/g,'')"></div>
			</li>
		</ul>

		<a href="javascript:;" class="btn register-btn">注册</a>
		<a href="/index.php?m=user&c=public&a=login" class="login-go-sign">
			已有账号
			<span>前去登陆&nbsp;&nbsp;<i class="iconfont">&#xe6a0;</i></span>
		</a>
	</div>

	<!-- S  -->
	<div class="popup-shade" id="shade"></div>
	<div class="popup-realName">
		<dl>
			<dt><img src="{THEME_PATH}images/real.png" alt="" width="125"></dt>
			<dd>实名认证 放心交易</dd>
		</dl>
		<ul class="flex flex-pack-justify">
			<li><a href="/index.php?m=user&c=public&a=login" class="btn">以后再说</a></li>
			<li><a href="javascript:;" class="btn to_11">前去认证</a></li>
		</ul>
	</div>

	
	
	<script>
	
		// function check_username(value){
		// 	if(!value || !(/^1[34578]\d{9}$/.test(value))){
		// 		layer.msg('请输入正确格式的手机号');
		// 	}
		// }
		function check_captcha(value){
			if(!value ||  !/^[a-zA-Z0-9]{4}$/.test(value)){
				layer.msg('请输入4位的验证');
			}
		}
		$('.register-btn').click(function(){
			var invite_code = $("input[name='invite_code']").val();
			var nickname = $("input[name='nickname']").val();
			var username = $("input[name='username']").val();
			var captcha = $("input[name='captcha']").val();
			var password = $("input[name='password']").val();
			var confirm_password = $("input[name='confirm_password']").val();
			var pay_password = $("input[name='pay_password']").val();
			var confirm_pay_password = $("input[name='confirm_pay_password']").val();
			if(!invite_code || !nickname || !username || !captcha || !password || !confirm_password || !pay_password || !confirm_pay_password){
				layer.msg('请输入要提交的信息');
			}
			if(password !==confirm_password){
				layer.msg('两次输入的登录密码不一致');
			}
			if(pay_password !==confirm_pay_password){
				layer.msg('两次输入的支付密码不一致');
			}
			$.ajax({
				url:"/index.php/?m=user&c=public&a=register",
				type:'post',
				data:{
					invite_code:invite_code,
					nickname:nickname,
					username:username,
					verify:captcha,
					password:password,
					confirm_password:confirm_password,
					pay_password:pay_password,
					confirm_pay_password:confirm_pay_password
				},
				dataType:'json',
				success:function(data){
					if(data.status ==0){
						layer.msg(data.info);
					}else{
						// window.location.reload();
						// layer.msg(data.info);
						$("#shade,.popup-realName").show();
						
						$('.to_11').click(function(){
							// var username = "<?php echo $username;?>";
							location.href = "/index.php?m=user&c=home&a=upload_identity&username="+data.info;
			
					})
						return;
					}
				}
			});
			
		})
		
	</script>
</body>
</html>